The embodiments disclosed herein relate to image processing and, more particularly, to methods and systems for image compression.
Digital images are often captured at high-resolution. Storing and transmitting large data files such as these can thus require larger storage space and more bandwidth than for low-resolution images. The size of the images can be reduced using an image compression technique. However, this generally entails a trade-off between the size and the quality of the resulting image.
Various image compression techniques are available. The Joint Bi-level Image Experts Group (JBIG2) standard, for example, provides an image compression algorithm for 1 bit (binary) images that can be used in a lossless or lossy compression. In operation, a JBIG2 encoder segments the input page into regions of text, regions of halftone images, and regions of other data. To compress the binary, textual regions, the foreground (e.g., black) pixels in the regions are grouped into symbols. A dictionary of symbol templates (patterns) is generated and used to describe the locations of identified symbols. The dictionary may be encoded using Huffman or Arithmetic coders. For lossy compression, any differences between similar symbols (e.g., slightly different impressions of the same letter) are ignored, while for lossless compression, this difference is taken into account. For lossless compression, the dictionary is created based on exact matching between the symbol and a template. Similar symbols that are not an exact match are compressed using another symbol as a template. In the lossy mode, the dictionary is created and updated based on the closest match between the symbol and a dictionary template, using thresholding.
In lossy compression, the file size is lower than for lossless compression, but there are risks of character replacement. Since this is undesirable, the lossy compression option has often been avoided. As a result, the savings in file size between a low quality setting and a high quality setting has not been as great.
A method which takes advantage of lossy compression but also minimizes character replacement is desirable.